package com.zzyl.quartz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzyl.nursing.domain.Contract;
import com.zzyl.nursing.mapper.ContractMapper;
import com.zzyl.quartz.service.ContractTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ContractTaskServiceImpl extends ServiceImpl<ContractMapper,Contract> implements ContractTaskService {
    @Autowired
    private ContractMapper contractMapper;

    @Override
    public List<Contract> findValidContracts() {
// 判断合同开始时间是否小于等于当前时间
        LambdaQueryWrapper<Contract> wrapper = Wrappers.<Contract>lambdaQuery().lt(Contract::getStartDate, new Date());
        List<Contract> contracts = contractMapper.selectList(wrapper);

        return contracts;
    }
}
